// eslint-disable-next-line

/**
 @param keepAlive          开启页面缓存
 @param permission          权限
 @param target: '_blank',   跳转外部地址
 @param hidden              隐藏路由/控制路由和子路由是否显示在 sidebar
 @param redirect            重定向地址, 访问这个路由时,自定进行重定向
 */

/*
权限 校验
v-if="$auth('dashboard.add')"  适用于tab

v-action:edit   适用于 button

*/
import {BasicLayout, BlankLayout, UserLayout} from '@/layouts'
import {setting} from '@/core/icons'

const RouteView = {
    name: 'RouteView',
    render: h => h('router-view')
}

export const asyncRouterMap = [
    {
        path: '/',
        name: 'index',
        redirect: '/admin/system',
        component: BlankLayout,
        meta: {
            title: '管理系统'
        },
        children: [
            {
                path: '/admin',
                name: 'admin',
                redirect: '/admin/system',
                meta: {title: '系统管理'},
                component: BasicLayout,
                children: [
                    {
                        path: '/admin/system',
                        name: 'system',
                        redirect: '/admin/system/datadictionary',
                        component: RouteView,
                        meta: {title: '系统管理', icon: setting,},
                        children: [
                            {
                                path: '/admin/system/datadictionary',
                                name: 'datadictionary',
                                component: () => import('@/views/admin/system/datadictionary'),
                                meta: {title: '数据字典', keepAlive: true,}
                            },
                            {
                                path: '/admin/system/structure',
                                name: 'structure',
                                component: () => import('@/views/admin/system/structure'),
                                meta: {
                                    title: '组织架构',
                                    keepAlive: true,
                                }
                            },
                            {
                                path: '/admin/system/personnelinfo',
                                name: 'personnelinfo',
                                component: () => import('@/views/admin/system/personnelinfo'),
                                meta: {
                                    title: '人员管理',
                                    keepAlive: true,
                                }
                            },
                            {
                                path: '/admin/system/modulement',
                                name: 'modulement',
                                component: () => import('@/views/admin/system/modulement'),
                                meta: {
                                    title: '模块管理',
                                    keepAlive: true,
                                }
                            },
                            {
                                path: '/admin/system/rolement',
                                name: 'rolement',
                                component: () => import('@/views/admin/system/rolement'),
                                meta: {
                                    title: '角色管理',
                                    keepAlive: true,
                                }
                            },
                            {
                                path: '/admin/system/menument',
                                name: 'menument',
                                component: () => import('@/views/admin/system/menument'),
                                meta: {title: '菜单管理', keepAlive: true,}
                            }, {
                                path: '/admin/system/sysAccessLog',
                                name: 'sysAccessLog',
                                component: () => import('@/views/admin/system/sysAccessLog'),
                                meta: {title: '访问日志', keepAlive: true,}
                            }, {
                                path: '/admin/system/sysSmsLog',
                                name: 'sysAccesysSmsLogssLog',
                                component: () => import('@/views/admin/system/sysSmsLog'),
                                meta: {title: '短信日志', keepAlive: true,}
                            }, {
                                path: '/admin/system/sysEmailLog',
                                name: 'sysEmailLog',
                                component: () => import('@/views/admin/system/sysEmailLog'),
                                meta: {title: '邮件日志', keepAlive: true,}
                            },
                            {
                                path: '/admin/system/sysconfig',
                                name: 'sysConfig',
                                component: () => import('@/views/admin/system/sysConfig'),
                                meta: {title: '系统配置', keepAlive: true,}
                            },
                        ]
                    },

                ],
            },

        ],
    },
    {
        path: '*',
        redirect: '/404',
        hidden: true
    },

]


/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
    {
        path: '/user',
        name: 'user',
        component: UserLayout,
        redirect: '/user/login',
        hidden: true,
        children: [{
            path: '/user/login',
            name: 'login',
            component: () => import( /* webpackChunkName: "user" */ '@/views/user/login')
        },
            {
                path: '/user/resetpwd',
                name: 'resetpwd',
                component: () => import('@/views/user/resetpwd')
            },]
    },
    {
        path: '/',
        name: 'index',
        component: BasicLayout,
        redirect: '/welcome',
        hidden: true,
        children: [{
            path: '/welcome',
            name: 'welcome',
            component: () => import('@/views/welcome'),
            meta: {
                title: '欢迎页',
                keepAlive: true
            },
        },]
    },
]
